<div class="portlet light bordered order-list-container" style="margin: 15px;">
	<div class="portlet-title">
		<div class="caption">
			<span class="caption-subject bold">Configuration Change Task List</span>
		</div>
		<div class="actions">
			<a target="_blank" ui-sref="wms.task.configurationChangeTask.group" permission-check="{{'task::configurationChangeTask_write'}}" ><b>Group Task</b></a>&nbsp; &nbsp;
			<a ui-sref="wms.task.configurationChangeTask.add" 	permission-check="{{'task::configurationChangeTask_write'}}" ><b>Add Task</b></a>
		</div>
	</div>
	<div class="portlet-body form form-horizontal">
		<form name="editForm">
			<div class="form-group">
				<div class="col-md-3">
					<label>Item:</label>
					<itemspec-auto-complete name="itemSpecId" ng-model="search.itemSpecId" name="itemSpec"
											on-select="itemSpecIdOnSelect(itemSpec)" allow-clear="true"/>
				</div>
		
			</div>
			<div class="form-group">
				<div class="col-md-3">
					<label>LP Configuration Template:</label>
					<lp-configuration-template-auto-complete ng-model="search.singleLPTemplateId"  allow-clear="true"> </lp-configuration-template-auto-complete>
				</div>
				<div class="col-md-3">
					<label>Assignee:</label>
					<user-auto-complete name="assignee" allow-clear="true" ng-model="search.assigneeUserId"></user-auto-complete>
				</div>
				<div class="col-md-3">
					<label>Task Way:</label>
					<ui-select ng-model="search.taskWay">
						<ui-select-match allow-clear="true">
							<span ng-bind="$select.selected"></span>
						</ui-select-match>
						<ui-select-choices repeat="item in ['Batch Configuration Change', 'Traditional'] | filter: $select.search">
							<span ng-bind="item"></span>
						</ui-select-choices>
					</ui-select>
				</div>
				<div class="col-md-3">
					<label>Task ID:</label>
					<lt-tags-input ng-model="search.taskIds" placeholder="Enter Task ID" fill="TASK-" ng-keyup="keyUpSearch($event)"></lt-tags-input>
				</div>
			</div>
			<div class="form-group">
				<div class="col-md-3">
					<label>Status</label>
					<task-status-auto-complete ng-model="search.status" allow-clear="true"></task-status-auto-complete>
				</div>
			</div>
			<div class="form-group form-actions right" >
				<waitting-btn type="button" btn-class="btn blue" ng-click="searchTask()"
							  value="'Search'" is-loading="loading"></waitting-btn>

			</div>
		</form>

		<div class="table-scrollable item-list-continer">
			<table class="table table-striped table-bordered table-hover">
				<thead>
					<tr>
						<th>Task ID</th>
						<th>Status</th>
						<th>Item</th>
						<th>QTY</th>
						<th>UOM</th>
						<th>LP Configuration Template</th>
						<th>Assignee</th>
						<th>Task Way</th>
						<th>Priority</th>
						<th>Created Time</th>
						<th permission-check="{{'task::configurationChangeTask_write'}}">Action</th>
					</tr>
				</thead>
				<tbody>
				     <tr ng-repeat="task in tasks track by $index">
						 <td> <a ng-href="{{'#/wms/task/configuration-change-task/' + task.id}}" title="View" target="_blank">{{task.id}}</a></td>
						 <td>
							 {{task.status}}
						 </td>
						 <td>
							 <item-display item="task"></item-display>
						 </td>
						 <td>
							 {{task.itemCount}}
						 </td>
						 <td>
							 {{task.unitName}}
						 </td>

						 <td>{{task.lpTemplate.name}}</td>

						 <td>{{task.assignee.firstName}} {{task.assignee.lastName}}</td>
						 <td>{{task.taskWay}}</td>
						 <td>{{task.priority}}</td>
						 <td>{{task.createdWhen | amDateFormat:'YYYY-MM-DD HH:mm:ss'}} &nbsp;<span ng-show="task.createdBy">({{task.createdBy}})</span></td>

						 <td permission-check="{{'task::configurationChangeTask_write'}}">
							 <a ng-click="deleteTask(task.id)" ng-show="task.status == 'New'"
								title="Delete">Delete</a>
						 </td>
					 </tr>
				</tbody>
			</table>
		</div>
		<pager total-count="paging.totalCount"  current-page ="paging.pageNo"page-size="pageObj.pageSize" load-content="loadContent(currentPage)"></pager>
	</div>
</div>
